package basic_1010;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner scanner=new Scanner(System.in);
		
		int N=scanner.nextInt();
		
		int D=scanner.nextInt();
		
		int[] store=new int[N];
		float[] price=new float[N];
		List<MoonCake>moonCakes=new ArrayList<MoonCake>();
		float totalSell=0;
		
		for(int i=0;i<N;i++) {
			store[i]=scanner.nextInt();
		}
		for(int i=0;i<N;i++) {
			price[i]=scanner.nextInt()*1.0f;
			if(store[i]>0) {
				moonCakes.add(new MoonCake(store[i], price[i]));
			}
		}
		
		scanner.close();
	
		Collections.sort(moonCakes, new Comparator<MoonCake>() {
			@Override
			public int compare(MoonCake m1, MoonCake m2) {

				if(m1.price/m1.store>=m2.price/m2.store) {
					return -1;
				}else {
					return 1;	
				}
			}
		});
		
		int sell=0;
		for(MoonCake moonCake:moonCakes) {
			if(D-sell>=moonCake.store) {
				totalSell+=moonCake.price;
				sell+=moonCake.store;
			}else {
				totalSell+=(D-sell)*moonCake.price/moonCake.store;
				sell=D;
			}
			
			if(D==sell) {
				break;
			}
		}
		
		System.out.println(String.format("%.2f", totalSell));
	}
	
	static class MoonCake{
		int store;
		float price;
		public MoonCake(int store,float price) {
			this.store=store;
			this.price=price;
		}
	}
}
